package com.bj58.groupbuy.action.service.impl;

import java.util.List;

import com.bj58.groupbuy.action.model.IRReport;
import com.bj58.groupbuy.action.service.IRReportService;
import com.bj58.groupbuy.service.impl.BaseService;
import com.bj58.groupbuy.wf.page.Paginate;

public class IRReportServiceImpl  extends BaseService<IRReport> implements IRReportService {

	@Override
	public Paginate<IRReport> getReportListByCon(int pageIndex, int pageSize,
			String where) throws Exception {
		return getGenericDao().findForPage(IRReport.class, where, "*", pageIndex, pageSize, " id desc");
	}

	@Override
	public IRReport getReportListByMenuId(int menuId) throws Exception {
		List<IRReport> rsList = getGenericDao().find(IRReport.class, "*", "menuId="+menuId, "");
		if( null != rsList  && !rsList.isEmpty() && rsList.size() == 1)
			return rsList.get(0);
		
		return null;
	}

	@Override
	public IRReport getById(int id) throws Exception {
		List<IRReport> rsList = getGenericDao().find(IRReport.class, "*", "id="+id, "");
		if( null != rsList  && !rsList.isEmpty() && rsList.size() == 1)
			return rsList.get(0);
		
		return null;
	}

}
